import request from '@/utils/request'

//查询用户列表
export function getUserInfoList(data){
  return  request ({
      url:'/admin/user/list',
      method:'get',
    params:data
  })
}

//新增用户
export function addUserInfo(data){
  return request({
    url: '/admin/user',
    method: 'post',
    data: data
  })
}

//编辑用户
export function updateUserInfo(data){
  return request({
    url: '/admin/user',
    method: 'put',
    data: data
  })
}

//删除用户
export function deleteUserInfo(userId){
  return request({
    url: `/admin/user/${userId}`,
    method: 'delete'
  })
}

//根据ID获取用户详情
export function getUserInfoById(userId){
  return request({
    url: `/admin/user/get/${userId}`,
    method: 'get'
  })
}

// 导出用户
export function exportUserInfo(query){
  return request({
    url: '/admin/user/export',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 导入用户
export function importUserInfo(formData){
  return request({
    url: '/admin/user/import',
    method: 'post',
    data: formData,
    headers: { 'Content-Type': 'multipart/form-data' }
  })
}
